<template>
  <div>
    <p>Gege--{{ count }}</p>

    <button @click="addHandle">累加并组件通信</button>
  </div>
</template>

<script>
export default {
  name: "Gege",
  data() {
    return {
      count: 1,
    };
  },
  methods: {
    addHandle() {
      this.count++;
      //触发$bus上的自定义事件count,那$bus上的count事件回调函数就会触发,并接受到值
      this.$bus.$emit("count", this.count);
    },
  },
};
</script>

<style></style>
